<template>
	 <zh-app style="font-family: '阿里巴巴普惠体'">		
		<zh-navbar title="家庭码管理" color="#85a5ff" linear="right"  />
		<zh-form-item :border="false">
			<view class="flex-1 mr-32" style="margin: 0 auto">
				<zh-button  @click="gotoFamilWebzs" >操作</zh-button>
			</view>
			
		</zh-form-item>
		</zh-app> 
</template>


<script lang="ts" setup>

	import { ref,reactive} from "vue";
	import { onLoad } from "@dcloudio/uni-app";	 
	import systemConfig from '@/common/config'
	 

	// ------------------接收传入参数(组件)-------------------

	// ------------------变量区------------------------------
	const paging=ref();
	// 主数据
	const data = reactive({		
		queryparm:{
			realPropertycx: '',
			clicked:false
		},
		canSearch:false
	})
	
	const zWJSScript = document.createElement('script')
	zWJSScript.setAttribute(
	  'src',
	  `//assets.zjzwfw.gov.cn/assets/ZWJSBridge/1.1.0/zwjsbridge.js`
	)
	document.head.appendChild(zWJSScript);
	
	
	
	//let gotourl = 'http://192.168.1.103:5173/web/mgop/gov-open/zj/2001807001/20230222-01/';
	//浙里办测试回调地址
	let gotourl = window.location.href;
	
	//openLink方式跳转家庭码--测试地址
	const gotoFamilWeb = () => {
		 console.log('gotoUrl：'+gotourl)
		const params: any =  {
		tokenId: systemConfig.familyTokenId,
		goto: gotourl,
		choose: '1'
		}		
		 	
		ZWJSBridge.openLink({
		//自定义参数
		//测试
		 url: `https://mapi.zjzwfw.gov.cn/web/mgop/gov-open/zj/2001907955/lastTest/index.html#/familyProvide/${encodeURIComponent(JSON.stringify(params))}`
		
		}).then((res:any) => {
		console.log('返回：'+res);
		}).catch((error:any)  => console.log('错误信息：'+error))
		
		 
		
	}
	
	//window.location方式跳转家庭码正式地址
	const gotoFamilWebzs = () => {
		 
		 const params: any =  {
		 tokenId: systemConfig.familyTokenId,
		 goto: gotourl,
		 choose: '1'
		 }		 
		 //console.log('tokenId：'+systemConfig.familyTokenId); 
		 //console.log('gotourl：'+gotourl);
		 // let uuu=systemConfig.familyUrl+`${encodeURIComponent(JSON.stringify(params))}`;
		 //  console.log('跳转地址：'+uuu);
		 
		 ZWJSBridge.openLink({
		 //自定义参数
		 //正式
		 // url: `https://mapi.zjzwfw.gov.cn/web/mgop/gov-open/zj/2001907955/reserved/index.html#/familyProvide/${encodeURIComponent(JSON.stringify(params))}` 
		 url: systemConfig.familyUrl+`${encodeURIComponent(JSON.stringify(params))}`		 
		 
		 }).then((res:any) => {
		 console.log('正式返回：'+res);
		 }).catch((error:any)  => console.log('错误信息正式：'+error))
		
	}
	

	
	
	 
	
	onLoad((options: any) => {
		console.log('初始化0000');		
		gotoFamilWebzs();
	})
</script>


<style lang="scss" scoped>
	.card {
		width: 670rpx;
		height: 80rpx;
		margin: 20rpx auto;
		padding: 20rpx;
		border-radius: 14rpx;
		box-shadow: rgb(51 51 51 / 15%) 0px 2px 6px;
		background-image: linear-gradient(to right, #FFFFFF, #d9d9d9);
	}
</style>